Android 短信发送

1
2
3
4
5
6
7
8
9
// 短信管理模块
public void SMSclick(View view) {

// 调用Android系统API发送短信
Uri uri = Uri.parse("smsto:5556");
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
intent.putExtra("sms_body", "android...");
startActivity(intent);
}
1
2
3
4
5
6
7
//发送短信管理模块
public void SMSsend(View view){

PendingIntent pi = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), 0);
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage("5554", null, "aa", pi, null);
}